<!-- sectionlist -->
<template>
  <div class="section-list">
    <div class="section-list-header">
      <div class="section-list-header-left">
        <div class="title">{{ title }}</div>
      </div>
      <div class="section-list-header-right">
        <img
          class="img"
          width="30px"
          height="30px"
          :src="addStaff ? staffAdd : staffDelete"
          @click="editStaff(addStaff)"
          alt="staff_add"
        />
      </div>
    </div>
    <div class="section-list-main">
      <ul class="content">
        <li v-for="(item, index) in data" class="item" :key="index">
          <head-img
            class="user-box"
            :src="item.src"
            line-height="88"
            @click="() => {}"
          ></head-img>
          <p class="text">{{ item.text }}</p>
        </li>
      </ul>
    </div>
    <SelectDialog
      v-model="isShow"
      title="Select name"
      label="fullName"
      :showCheckbox="false"
      :showSelect="true"
      :desc="desc"
      :max="4"
      :data="listData2"
      @submit="changeCourseSelect"
      @change="change"
    />
  </div>
</template>

<script>
export default {
  name: "SectionList",
  components: {},
  data() {
    return {
      staffAdd: require("@/assets/images/menu/staff_add.svg"),
      staffDelete: require("@/assets/images/menu/staff_delete.svg"),
      isShow: false,
      listData2: new Array(20).fill(0).map((item, index) => ({
        id: index,
        avatar: "",
        firstName: `十${index}`,
        lastName: "张",
        fullName: `张十${index}`,
        email: `${parseInt(Math.random() * 1000, 10)}@edoovo.com`,
        isUser: true,
      })),
      desc: "0 enrolled students for the class size of 4",
    };
  },
  props: {
    title: String,
    data: {
      type: Array,
      default: [],
    },
    addStaff: {
      type: Boolean,
      default: true,
    },
  },
  methods: {
    editStaff(type) {
      if (type) {
        this.isShow = true;
      }
    },
    changeCourseSelect() {},
    change() {},
  },
  created() {},
};
</script>
<style lang='less' scoped>
.section-list {
  min-height: 132px;
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  &-header {
    height: 68px;
    padding: 20px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #e0e0e0;
    &-left {
      display: flex;
      align-items: center;
      .title {
        font-family: OpenSans-Bold;
        font-size: 22px;
        color: #202124;
      }
    }
    &-right {
      .img {
        cursor: pointer;
      }
    }
  }
  &-main {
    padding: 0 20px;
    margin: 20px 0;
    color: #202124;
    font-family: Roboto;
    font-size: 14px;
    overflow-y: auto;
    .content {
      display: flex;
      flex-wrap: wrap;
    }
    .item {
      width: 136px;
      height: 116px;
      margin-bottom: 28px;
      //   margin-right: 32px;
      display: flex;
      flex-direction: column;
      align-items: center;
      .text {
        margin-top: 9px;
        width: 100%;
        height: 19px;
        line-height: 19px;
        color: #1a73e8;
        font-family: Roboto-medium;
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
      }
    }
  }
}
</style>